package com.ttn.student.controller;

import com.ttn.common.core.entity.Result;
import com.ttn.common.core.entity.studentrecord.bo.SaveHearingDetailsStudyRecordDetailsBO;
import com.ttn.common.core.entity.studentrecord.query.TestStudyRecordQuery;
import com.ttn.student.service.HearingDetailsStudyRecordDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * (hearing_details_study_record_details)表控制层
 *
 * @author xxxxx
 */
@RestController
@Slf4j
@RequestMapping("/hearing-details-study-record-details")
public class HearingDetailsStudyRecordDetailsController {
    /**
     * 服务对象
     */
    @Resource
    private HearingDetailsStudyRecordDetailsService hearingDetailsStudyRecordDetailsService;

    @PostMapping("/save/hearing-details-study-record-details")
    public Result saveHearingDetailsStudyRecordDetails(HttpServletRequest request,
                                                       @RequestBody SaveHearingDetailsStudyRecordDetailsBO saveHearingDetailsStudyRecordDetailsBO) {
        log.info("HearingDetailsStudyRecordDetailsController saveHearingDetailsStudyRecordDetails 参数:{}", saveHearingDetailsStudyRecordDetailsBO);
        return hearingDetailsStudyRecordDetailsService.saveHearingDetailsStudyRecordDetails(saveHearingDetailsStudyRecordDetailsBO.getHearingDetailsStudyRecordDetailsList());
    }

    /**
     * 查询测试记录
     *
     * @param request
     * @param testStudyRecordQuery
     * @return
     */
    @PostMapping("/query/hearing-details-study-record-details")
    public Result queryHearingDetailsStudyRecordDetails(HttpServletRequest request, @RequestBody TestStudyRecordQuery testStudyRecordQuery) {

        log.info("VocabularyStudyRecordDetailsController queryHearingDetailsStudyRecordDetails ,参数:{}", testStudyRecordQuery);
        return hearingDetailsStudyRecordDetailsService.queryHearingDetailsStudyRecordDetails(testStudyRecordQuery);
    }

}
